﻿<%@ Page title="" Language="C#" AutoEventWireup="false" 
     CodeFile="rptReportViewer.aspx.cs" Inherits="SIPO.Web.Reports.rptReportViewer" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="head" runat="server">
    <title>Menu Form</title>
</head>
    <link type="text/css" rel="stylesheet" href="<%= ResolveUrl("~/styles/ui.jqgrid.css") %>" />
    <script type="text/javascript" src="<%= ResolveUrl("~/scripts/i18n/grid.locale-id.js") %>"></script>
    <script type="text/javascript" src="<%= ResolveUrl("~/scripts/jquery.jqGrid.min.js") %>"></script>
    <script src="<%= ResolveUrl("~/scripts/helper.js") %>" type="text/javascript"></script>
    <script type="text/javascript">
       
        $("#btnPrint").button({ icons: { primary: "ui-icon-print"} });

        $("#btnPrint").click(function () {
            var formUrl = '<%= ResolveUrl("~/reports/Transaction/rptPrintBilling.aspx") %>';
            var periodeAwal = $("#hfPeriodeAwal").val();
            var periodeAkhir = $("#hfPeriodeAkhir").val();
            var dueDateAwal = $("#hfDueDateAwal").val();
            var dueDateAkhir = $("#hfDueDateAkhir").val();
            var transTypeID = $("#hfTransTypeID").val();
            var debtorSectorID = $("#hfDebtorSectorID").val();
            var balance = $("#hfBalance").val();
            var userID = $("#hfUserID").val();

            window.open(formUrl + "?periodeAwal=" + periodeAwal + "&periodeAkhir=" + periodeAkhir + "&dueDateAwal=" + dueDateAwal + "&dueDateAkhir=" + dueDateAkhir + "&transTypeID=" + transTypeID + "&debtorSectorID=" + debtorSectorID + "&balance=" + balance + "&userID=" + userID);
            //window.open(formUrl);
        });
    </script>

    <script type="text/javascript">
        var handlerUrl = '<%= ResolveUrl("~/Ajaxhandler/Transaction/recBillinghandler.ashx") %>';

        $('#table').jqGrid({
            
            url: handlerUrl + "?method=getdatareport",
            postData: {
                PeriodeAwal: function () { return $("#hfPeriodeAwal").val() },
                PeriodeAkhir: function () { return $("#hfPeriodeAkhir").val() },
                DueDateAwal: function () { return $("#hfDueDateAwal").val() },
                DueDateAkhir: function () { return $("#hfDueDateAkhir").val() },
                TransTypeID: function () { return $("#hfTransTypeID").val() },
                DebtorSectorID: function () { return $("#hfDebtorSectorID").val() },
                Balance: function () { return $("#hfBalance").val() }
            },
            datatype: 'json',
            colNames: ['Debtor Sector ID', 'Nama Debitur ', 'Jenis Trans.', 'Tagihan', 'Balance', 'Billing Date', 'Due Date'],
            colModel: [
           		{ name: 'DebtorSectorID', index: 'DebtorSectorID', align: 'center', searchoptions: { sopt: ['eq', 'cn'] }, width: 200 },
                { name: 'recDebtor.DebtorName', index: 'DebtorName', align: 'center', searchoptions: { sopt: ['eq', 'cn'] }, width: 300 },
                { name: 'recTransactionType.TransTypeName', index: 'TransTypeName', align: 'center', searchoptions: { sopt: ['eq', 'cn'] }, width: 200 },
                { name: 'Value', index: 'Value', width: 200, formatter: 'currency', formatoptions: { prefix: '', suffix: '', thousandsSeparator: ',' }, align: 'right' },
                { name: 'Balance', index: 'Balance', width: 200, formatter: 'currency', formatoptions: { prefix: '', suffix: '', thousandsSeparator: ',' }, align: 'right' },
                { name: 'BillingDate', index: 'BillingDate', align: 'center', width: 300, formatter: 'date', formatoptions: { newformat: 'd M Y'} },
                { name: 'DueDate', index: 'DueDate', align: 'center', width: 300, formatter: 'date', formatoptions: { newformat: 'd M Y'} },
           	],
            rowNum: 10,
            id: 'DebtorSectorID',
            multiselect: false,
            rowList: [5, 10, 15, 20],
            pager: '#pager',
            sortname: 'recBilling.DebtorSectorID',
            sortorder: "asc",
            viewrecords: true,
            jsonReader: { repeatitems: false },
            width: 700,
            height: '100%',
            caption: 'Aksi',
            ajaxGridOptions: { cache: false }

        });

        $("#table").jqGrid('navGrid', '#pager', { edit: false, add: false, del: false, searchtext: 'Search', refreshtext: 'Refresh' },
        {}, {}, {}, { closeOnEscape: true, multipleSearch: true, closeAfterSearch: true, showQuery: true });
        </script>

<body>
    <form id="form1" runat="server">
    <div>
        <button id="btnPrint" type="button">Cetak</button>
    </div>
    <br />
    
    <table id="table" class="scroll" cellpadding="0" cellspacing="0">
    </table>
    <div id="pager" class="scroll">
    </div>
    <asp:HiddenField ID="hfPeriodeAwal" runat="server" />
    <asp:HiddenField ID="hfPeriodeAkhir" runat="server" />
    <asp:HiddenField ID="hfDueDateAwal" runat="server" />
    <asp:HiddenField ID="hfDueDateAkhir" runat="server" />
    <asp:HiddenField ID="hfTransTypeID" runat="server" />
    <asp:HiddenField ID="hfDebtorSectorID" runat="server" />
    <asp:HiddenField ID="hfBalance" runat="server" />
    <asp:HiddenField ID="hfUserID" runat="server" />
    </form>
</body>
</html>
